//
//  UserTableViewCell.m
//  Drops
//
//  Created by dllo on 16/6/2.
//  Copyright © 2016年 Drops.er. All rights reserved.
//

#import "UserTableViewCell.h"

@implementation UserTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.contentView.backgroundColor = [UIColor blackColor];
        self.image = [[UIImageView alloc]init];
        self.image.backgroundColor = [UIColor clearColor];
        [self.contentView addSubview:self.image];
        
        self.user = [[UILabel alloc]init];
        self.user.backgroundColor = [UIColor clearColor];
        self.user.textColor = [UIColor whiteColor];
        [self.contentView addSubview:self.user];
    }
    return self;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    CGFloat w = self.image.image.size.width * 300 / self.image.image.size.height;
    self.image.frame = CGRectMake(self.contentView.frame.size.width / 2 - (w / 2), 0, w, self.contentView.frame.size.height);
    self.user.frame = CGRectMake(20, self.contentView.frame.size.height - 30 , self.contentView.frame.size.width - 40, 30);
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
